Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: fix firstrow/max/min(bit col) error #7206

Merged
merged 9 commits into from
Aug 1, 2018

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Jul 31, 2018

What have you changed? (mandatory)

Before this PR:

CREATE TABLE `t` (
  `a` bit(1) NOT NULL,
  PRIMARY KEY (`a`)
);
insert into t value(1);
select max(a) from t group by a;

we'll get panic

lastCmd select max( a) from t group by
a, runtime error: index out of range

After this PR:

tidb> select max(a) from t group by a;
+---+
| a |
+---+
|  |
+---+
1 row in set (0.00 sec)

What is the type of the changes? (mandatory)

  • Bug fix (non-breaking change which fixes an issue)

How has this PR been tested? (mandatory)

integration test

Does this PR affect documentation (docs/docs-cn) update? (mandatory)

no

Does this PR affect tidb-ansible update? (mandatory)

no

Does this PR need to be added to the release notes? (mandatory)

no

Refer to a related PR or issue link (optional)

#6952

Benchmark result if necessary (optional)

Add a few positive/negative examples (optional)

winoros
winoros previously approved these changes Jul 31, 2018
Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

zz-jason
zz-jason previously approved these changes Jul 31, 2018
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason
Copy link
Member

/run-all-tests

@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. sig/execution SIG execution labels Jul 31, 2018
@zz-jason zz-jason added this to the 2.1 milestone Jul 31, 2018
tk.MustExec("drop table t")
tk.MustExec("create table t(a bit(1))")
tk.MustExec("insert into t value(1), (0)")
result = tk.MustQuery("select cast(a as signed) as idx, cast(max(a) as signed), cast(min(a) as signed) from t group by 1 order by idx")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not panic?

@XuHuaiyu XuHuaiyu dismissed stale reviews from zz-jason and winoros via b582aa0 July 31, 2018 12:15
@XuHuaiyu
Copy link
Contributor Author

PTAL @IamxTyler

@XuHuaiyu
Copy link
Contributor Author

/run-common-test
/run-integration-common-test

tk.MustExec("CREATE TABLE `t` (`a` bit(1) NOT NULL, PRIMARY KEY (`a`))")
tk.MustExec("insert into t value(1), (0)")
tk.MustQuery("select a from t group by 1")
tk.MustQuery("select max(a) from t group by a")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check their results?

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason merged commit d5c5115 into pingcap:master Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants